﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReqHelpMasterForm.aspx.cs"
    Inherits="FX.CC.Andon.WebSite.BasicDataManage.ReqHelpMasterForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>求助人员管理</title>
    <script src="../lib/boot.js" type="text/javascript"></script>
</head>
<body>
    <div class="mini-toolbar" style="padding: 2px;">
        <table style="width: 100%;">
            <tr>
                <td>
                    车间：<div id="WSID" name="WSID" class="mini-combobox" style="width: 150px;" popupwidth="300"
                        onvaluechanged="onWSIDChanged" textfield="WSName" valuefield="WSID" url="../Service/BasicDataManageHandler.ashx?action=GetWorkShopListByCombobox">
                        <div property="columns">
                            <div header="车间编号" field="WSCode" width="40%">
                            </div>
                            <div header="车间名称" field="WSName" width="60%">
                            </div>
                        </div>
                    </div>
                    异常原因：
                    <div id="ETypeCode" name="ETypeCode" class="mini-combobox" style="width: 150px;"
                        onvaluechanged="onETypeCodeChanged" popupwidth="300" textfield="ETypeName" valuefield="ETypeCode"
                        url="../Service/BasicDataManageHandler.ashx?action=GetETypeListByCombobox">
                        <div property="columns">
                            <div header="异常原因编号" field="ETypeCode" width="40%">
                            </div>
                            <div header="异常原因名称" field="ETypeName" width="60%">
                            </div>
                        </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-toolbar" style="padding: 2px; border-top: 0; border-bottom: 0;">
        <a class="mini-button" iconcls="icon-add" onclick="add();" plain="true">添加</a> <a
            class="mini-button" iconcls="icon-edit" onclick="edit()" plain="true">编辑</a>
        <a class="mini-button" iconcls="icon-remove" onclick="remove()" plain="true">删除</a>
        <span class="separator"></span><a class="mini-button" onclick="close()" iconcls="icon-close"
            plain="true">关闭</a>
    </div>
    <div class="mini-fit">
        <div id="grid1" class="mini-datagrid" style="width: 100%; border-top: 0; height: 100%;"
            idfield="ReqID" sizelist="[10,20,50,100]" pagesize="20">
            <div property="columns">
                <div type="indexcolumn">
                </div>
                <div field="LoginCode" width="120" headeralign="center" allowsort="true">
                    登录账号
                </div>
                <div field="FullName" width="120" headeralign="center" allowsort="true">
                    姓名
                </div>
                <div field="MobileNo" width="120" headeralign="center" allowsort="true">
                    手机号码
                </div>
                <div field="DptName" width="100" headeralign="center" allowsort="true">
                    所属部门
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">

    mini.parse();
    var grid1 = mini.get("grid1");
    function onWSIDChanged(e) {
        var ETypeCode = mini.get("ETypeCode").getValue();
        if (ETypeCode) {
            grid1.setUrl("../service/BasicDataManageHandler.ashx?action=GetReqHelpList");
            grid1.load({ ETypeCode: ETypeCode, WSID: e.value });
        }
    }
    function onETypeCodeChanged(e) {
        var WSID = mini.get("WSID").getValue();
        if (WSID) {
            grid1.setUrl("../service/BasicDataManageHandler.ashx?action=GetReqHelpList");
            grid1.load({ ETypeCode: e.value, WSID: WSID });
        }
    }
    function add() {
        mini.open({
            url: "BasicDataManage/AddReqHelpInfoForm.aspx",
            title: "新增求助人员", width: 800, height: 530,
            onload: function () {
                var iframe = this.getIFrameEl();
                var data = { action: "new" };
                iframe.contentWindow.SetData(data);
            },
            ondestroy: function (action) {
                grid1.reload();
            }
        });
    }
    function ondoubleclick() {
        edit();
    }
    function edit() {
        mini.open({
            url: "BasicDataManage/ReqHelpInfoForm.aspx",
            title: "新增求助人员", width: 800, height: 530,
            onload: function () {
                var iframe = this.getIFrameEl();
                var data = { action: "edit" };
                iframe.contentWindow.SetData(data);
            },
            ondestroy: function (action) {
                grid1.reload();
            }
        });
    }
    function remove() {
        var rows = grid1.getSelected();
        if (rows) {
            mini.confirm("您确定删除" + rows.FullName + "吗？", "确定？",
                        function (action) {
                            if (action == "ok") {
                                $.ajax({
                                    url: "../service/BasicDataManageHandler.ashx?action=RemoveReqHelp&ReqID=" + rows.ReqID,
                                    success: function (text) {
                                        grid1.reload();
                                    },
                                    error: function () {
                                    }
                                });

                            } else {
                                return false;
                            }
                        });
        } else {
            mini.alert("请选中一条您需要删除的记录!");
        }
    }

    function CloseWindow(action) {
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }

    function close() {
        CloseWindow("close");
    }

</script>
</html>
